//删除
var box3 = document.querySelectorAll(".box3");
//删除的li
var orange = document.querySelectorAll(".orange");
//获取删除li的父级
var navigation = document.querySelectorAll(".navigation");




var jia = document.querySelectorAll(".jia");
var num = document.querySelectorAll(".number");
var wc = document.querySelector('.wcwzbd')

var hcs = function () {
    var sum = document.querySelectorAll(".sum");
    var zonghe = 0;
    for(var a = 0;a<sum.length;a++){
        console.log(zonghe)
        // sum[a].index = a;
        zonghe += Number(sum[a].innerHTML);
    }
     wc.innerHTML=zonghe.toFixed(2);
}

for(var i = 0;i<box3.length;i++){
    //绑定下标
    box3[i].index = i;
    num[i].index = i;
    //绑定点击事件
    box3[i].onclick=function() {
        // var sum = document.querySelectorAll(".sum");
        //removeChild移除
        navigation[this.index+1].removeChild(orange[this.index])
        hcs();
    }
    num[i].onkeyup=function () {
        var sum = document.querySelectorAll(".sum");
        var wcwz = jia[this.index].innerHTML * num[this.index].value
        sum[this.index].innerHTML = wcwz.toFixed(2);
        hcs()
    }
}
hcs()